% Remember to use the lgrind style

\Head{}
\File{sccmap.c}{2013}{3}{6}{13:05}{7401}
\L{\LB{}}
\L{\LB{\C{}/*************************************************************************}}
\L{\LB{_*_Copyright_(c)_2011_AT\&T_Intellectual_Property_}}
\L{\LB{_*_All_rights_reserved._This_program_and_the_accompanying_materials}}
\L{\LB{_*_are_made_available_under_the_terms_of_the_Eclipse_Public_License_v1.0}}
\L{\LB{_*_which_accompanies_this_distribution,_and_is_available_at}}
\L{\LB{_*_https://www.eclipse.org/legal/epl-v10.html}}
\L{\LB{_*}}
\L{\LB{_*_Contributors:_See_CVS_logs._Details_at_http://www.graphviz.org/}}
\L{\LB{_*************************************************************************/\CE{}}}
\L{\LB{}}
\L{\LB{\K{\#ifdef}_\V{HAVE\_CONFIG\_H}}}
\L{\LB{\K{\#include}_\S{}\3config.h\3\SE{}}}
\L{\LB{\K{\#endif}}}
\L{\LB{}}
\L{\LB{\K{\#include}_\<\V{stdio}.\V{h}\>}}
\L{\LB{\K{\#include}_\<\V{stdlib}.\V{h}\>}}
\L{\LB{\K{\#ifdef}_\V{HAVE\_UNISTD\_H}}}
\L{\LB{\K{\#include}_\<\V{unistd}.\V{h}\>}}
\L{\LB{\K{\#endif}}}
\L{\LB{\K{\#include}_\S{}\3cgraph.h\3\SE{}}}
\L{\LB{\K{\#include}_\S{}\3ingraphs.h\3\SE{}}}
\L{\LB{}}
\L{\LB{\K{\#ifdef}_\V{HAVE\_GETOPT\_H}}}
\L{\LB{\K{\#include}_\<\V{getopt}.\V{h}\>}}
\L{\LB{\K{\#else}}}
\L{\LB{\K{\#include}_\S{}\3compat\_getopt.h\3\SE{}}}
\L{\LB{\K{\#endif}}}
\L{\LB{}}
\L{\LB{\K{\#define}_\V{INF}_((\K{unsigned}_\K{int})(\-\N{1}))}}
\L{\LB{}}
\L{\LB{\K{typedef}_\K{struct}_\V{Agraphinfo\_t}_\{}}
\L{\LB{}\Tab{4}{\V{Agrec\_t}_\V{h};}}
\L{\LB{}\Tab{4}{\V{Agnode\_t}_*\V{rep};}}
\L{\LB{\}_\V{Agraphinfo\_t};}}
\L{\LB{}}
\L{\LB{\K{typedef}_\K{struct}_\V{Agnodeinfo\_t}_\{}}
\L{\LB{}\Tab{4}{\V{Agrec\_t}_\V{h};}}
\L{\LB{}\Tab{4}{\K{unsigned}_\K{int}_\V{val};}}
\L{\LB{}\Tab{4}{\V{Agraph\_t}_*\V{scc};}}
\L{\LB{\}_\V{Agnodeinfo\_t};}}
\L{\LB{}}
\L{\LB{\K{\#define}_\V{getrep}(\V{g})}\Tab{19}{(((\V{Agraphinfo\_t}*)(\V{g}\-\!\>\V{base}.\V{data}))\-\!\>\V{rep})}}
\L{\LB{\K{\#define}_\V{setrep}(\V{g},\V{rep})}\Tab{23}{(\V{getrep}(\V{g})_=_\V{rep})}}
\L{\LB{\K{\#define}_\V{getscc}(\V{n})}\Tab{21}{(((\V{Agnodeinfo\_t}*)((\V{n})\-\!\>\V{base}.\V{data}))\-\!\>\V{scc})}}
\L{\LB{\K{\#define}_\V{setscc}(\V{n},\V{sub})}\Tab{25}{(\V{getscc}(\V{n})_=_\V{sub})}}
\L{\LB{\K{\#define}_\V{getval}(\V{n})}\Tab{21}{(((\V{Agnodeinfo\_t}*)((\V{n})\-\!\>\V{base}.\V{data}))\-\!\>\V{val})}}
\L{\LB{\K{\#define}_\V{setval}(\V{n},\V{newval})}\Tab{28}{(\V{getval}(\V{n})_=_\V{newval})}}
\L{\LB{}}
\L{\LB{\C{}/*********_stack_***********/\CE{}}}
\L{\LB{\K{typedef}_\K{struct}_\{}}
\L{\LB{}\Tab{4}{\V{Agnode\_t}_**\V{data};}}
\L{\LB{}\Tab{4}{\V{Agnode\_t}_**\V{ptr};}}
\L{\LB{\}_\V{Stack};}}
\L{\LB{}}
\index{initStack}\Proc{initStack}\L{\LB{\K{static}_\K{void}_\V{initStack}(\V{Stack}_*_\V{sp},_\K{int}_\V{sz})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\V{sp}\-\!\>\V{data}_=_(\V{Agnode\_t}_**)_\V{malloc}(\V{sz}_*_\K{sizeof}(\V{Agnode\_t}_*));}}
\L{\LB{}\Tab{4}{\V{sp}\-\!\>\V{ptr}_=_\V{sp}\-\!\>\V{data};}}
\L{\LB{\}}}
\L{\LB{}}
\index{freeStack}\Proc{freeStack}\L{\LB{\K{static}_\K{void}_\V{freeStack}(\V{Stack}_*_\V{sp})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\V{free}(\V{sp}\-\!\>\V{data});}}
\L{\LB{\}}}
\L{\LB{}}
\index{push}\Proc{push}\L{\LB{\K{static}_\K{void}_\V{push}(\V{Stack}_*_\V{sp},_\V{Agnode\_t}_*_\V{n})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{*(\V{sp}\-\!\>\V{ptr}++)_=_\V{n};}}
\L{\LB{\}}}
\L{\LB{}}
\index{top}\Proc{top}\L{\LB{\K{static}_\V{Agnode\_t}_*\V{top}(\V{Stack}_*_\V{sp})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\K{return}_*(\V{sp}\-\!\>\V{ptr}_\-_\N{1});}}
\L{\LB{\}}}
\L{\LB{}}
\index{pop}\Proc{pop}\L{\LB{\K{static}_\V{Agnode\_t}_*\V{pop}(\V{Stack}_*_\V{sp})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\V{sp}\-\!\>\V{ptr}\-\-;}}
\L{\LB{}\Tab{4}{\K{return}_*(\V{sp}\-\!\>\V{ptr});}}
\L{\LB{\}}}
\L{\LB{}}
\L{\LB{\C{}/*********_end_stack_***********/\CE{}}}
\L{\LB{}}
\L{\LB{\K{typedef}_\K{struct}_\{}}
\L{\LB{}\Tab{4}{\K{int}_\V{Comp};}}
\L{\LB{}\Tab{4}{\K{int}_\V{ID};}}
\L{\LB{}\Tab{4}{\K{int}_\V{N\_nodes\_in\_nontriv\_SCC};}}
\L{\LB{\}_\V{sccstate};}}
\L{\LB{}}
\L{\LB{\K{static}_\K{int}_\V{wantDegenerateComp};}}
\L{\LB{\K{static}_\K{int}_\V{Silent};}}
\L{\LB{\K{static}_\K{int}_\V{StatsOnly};}}
\L{\LB{\K{static}_\K{int}_\V{Verbose};}}
\L{\LB{\K{static}_\K{char}_*\V{CmdName};}}
\L{\LB{\K{static}_\K{char}_**\V{Files};}}
\L{\LB{\K{static}_\V{FILE}_*\V{outfp};}\Tab{32}{\C{}/*_output;_stdout_by_default_*/\CE{}}}
\L{\LB{}}
\index{nodeInduce}\Proc{nodeInduce}\L{\LB{\K{static}_\K{void}_\V{nodeInduce}(\V{Agraph\_t}_*_\V{g},_\V{Agraph\_t}_*_\V{map})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\V{Agnode\_t}_*\V{n};}}
\L{\LB{}\Tab{4}{\V{Agedge\_t}_*\V{e};}}
\L{\LB{}\Tab{4}{\V{Agraph\_t}_*\V{rootg}_=_\V{agroot}(\V{g});}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\K{for}_(\V{n}_=_\V{agfstnode}(\V{g});_\V{n};_\V{n}_=_\V{agnxtnode}(\V{g},_\V{n}))_\{}}
\L{\LB{}\Tab{8}{\K{for}_(\V{e}_=_\V{agfstout}(\V{rootg},_\V{n});_\V{e};_\V{e}_=_\V{agnxtout}(\V{rootg},_\V{e}))_\{}}
\L{\LB{}\Tab{12}{\K{if}_(\V{agsubnode}(\V{g},_\V{aghead}(\V{e}),_\V{FALSE}))}}
\L{\LB{}\Tab{16}{\V{agsubedge}(\V{g},_\V{e},_\V{TRUE});}}
\L{\LB{}\Tab{12}{\K{else}_\{}}
\L{\LB{}\Tab{16}{\V{Agraph\_t}_*\V{tscc}_=_\V{getscc}(\V{agtail}(\V{e}));}}
\L{\LB{}\Tab{16}{\V{Agraph\_t}_*\V{hscc}_=_\V{getscc}(\V{aghead}(\V{e}));}}
\L{\LB{}\Tab{16}{\K{if}_(\V{tscc}_\&\&_\V{hscc})}}
\L{\LB{}\Tab{20}{\V{agedge}(\V{map},_\V{getrep}(\V{tscc}),}}
\L{\LB{}\Tab{27}{\V{getrep}(\V{hscc}),_\V{NIL}(\K{char}_*),_\V{TRUE});}}
\L{\LB{}\Tab{12}{\}}}
\L{\LB{}\Tab{8}{\}}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{\}}}
\L{\LB{}}
\index{visit}\Proc{visit}\L{\LB{\K{static}_\K{int}_\V{visit}(\V{Agnode\_t}_*_\V{n},_\V{Agraph\_t}_*_\V{map},_\V{Stack}_*_\V{sp},_\V{sccstate}_*_\V{st})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\K{unsigned}_\K{int}_\V{m},_\V{min};}}
\L{\LB{}\Tab{4}{\V{Agnode\_t}_*\V{t};}}
\L{\LB{}\Tab{4}{\V{Agraph\_t}_*\V{subg};}}
\L{\LB{}\Tab{4}{\V{Agedge\_t}_*\V{e};}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\V{min}_=_++(\V{st}\-\!\>\V{ID});}}
\L{\LB{}\Tab{4}{\V{setval}(\V{n},_\V{min});}}
\L{\LB{}\Tab{4}{\V{push}(\V{sp},_\V{n});}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\K{for}_(\V{e}_=_\V{agfstout}(\V{n}\-\!\>\V{root},_\V{n});_\V{e};_\V{e}_=_\V{agnxtout}(\V{n}\-\!\>\V{root},_\V{e}))_\{}}
\L{\LB{}\Tab{8}{\V{t}_=_\V{aghead}(\V{e});}}
\L{\LB{}\Tab{8}{\K{if}_(\V{getval}(\V{t})_==_\N{0})}}
\L{\LB{}\Tab{12}{\V{m}_=_\V{visit}(\V{t},_\V{map},_\V{sp},_\V{st});}}
\L{\LB{}\Tab{8}{\K{else}}}
\L{\LB{}\Tab{12}{\V{m}_=_\V{getval}(\V{t});}}
\L{\LB{}\Tab{8}{\K{if}_(\V{m}_\<_\V{min})}}
\L{\LB{}\Tab{12}{\V{min}_=_\V{m};}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\K{if}_(\V{getval}(\V{n})_==_\V{min})_\{}}
\L{\LB{}\Tab{8}{\K{if}_(!\V{wantDegenerateComp}_\&\&_(\V{top}(\V{sp})_==_\V{n}))_\{}}
\L{\LB{}\Tab{12}{\V{setval}(\V{n},_\V{INF});}}
\L{\LB{}\Tab{12}{\V{pop}(\V{sp});}}
\L{\LB{}\Tab{8}{\}_\K{else}_\{}}
\L{\LB{}\Tab{12}{\K{char}_\V{name}[\N{32}];}}
\L{\LB{}\Tab{12}{\V{Agraph\_t}_*\V{G}_=_\V{agraphof}(\V{n});;}}
\L{\LB{}\Tab{12}{\V{sprintf}(\V{name},_\S{}\3cluster\_\%d\3\SE{},_(\V{st}\-\!\>\V{Comp})++);}}
\L{\LB{}\Tab{12}{\V{subg}_=_\V{agsubg}(\V{G},_\V{name},_\V{TRUE});}}
\L{\LB{}\Tab{12}{\V{agbindrec}(\V{subg},_\S{}\3scc\_graph\3\SE{},_\K{sizeof}(\V{Agraphinfo\_t}),_\V{TRUE});}}
\L{\LB{}\Tab{12}{\V{setrep}(\V{subg},_\V{agnode}(\V{map},_\V{name},_\V{TRUE}));}}
\L{\LB{}\Tab{12}{\K{do}_\{}}
\L{\LB{}\Tab{16}{\V{t}_=_\V{pop}(\V{sp});}}
\L{\LB{}\Tab{16}{\V{agsubnode}(\V{subg},_\V{t},_\V{TRUE});}}
\L{\LB{}\Tab{16}{\V{setval}(\V{t},_\V{INF});}}
\L{\LB{}\Tab{16}{\V{setscc}(\V{t},_\V{subg});}}
\L{\LB{}\Tab{16}{\V{st}\-\!\>\V{N\_nodes\_in\_nontriv\_SCC}++;}}
\L{\LB{}\Tab{12}{\}_\K{while}_(\V{t}_!=_\V{n});}}
\L{\LB{}\Tab{12}{\V{nodeInduce}(\V{subg},_\V{map});}}
\L{\LB{}\Tab{12}{\K{if}_(!\V{StatsOnly})}}
\L{\LB{}\Tab{16}{\V{agwrite}(\V{subg},_\V{outfp});}}
\L{\LB{}\Tab{8}{\}}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{\K{return}_\V{min};}}
\L{\LB{\}}}
\L{\LB{}}
\index{label}\Proc{label}\L{\LB{\K{static}_\K{int}_\V{label}(\V{Agnode\_t}_*_\V{n},_\K{int}_\V{nodecnt},_\K{int}_*\V{edgecnt})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\V{Agedge\_t}_*\V{e};}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\V{setval}(\V{n},_\N{1});}}
\L{\LB{}\Tab{4}{\V{nodecnt}++;}}
\L{\LB{}\Tab{4}{\K{for}_(\V{e}_=_\V{agfstedge}(\V{n}\-\!\>\V{root},_\V{n});_\V{e};_\V{e}_=_\V{agnxtedge}(\V{n}\-\!\>\V{root},_\V{e},_\V{n}))_\{}}
\L{\LB{}\Tab{8}{(*\V{edgecnt})_+=_\N{1};}}
\L{\LB{}\Tab{8}{\K{if}_(\V{e}\-\!\>\V{node}_==_\V{n})}}
\L{\LB{}\Tab{12}{\V{e}_=_\V{agopp}(\V{e});}}
\L{\LB{}\Tab{8}{\K{if}_(!\V{getval}(\V{e}\-\!\>\V{node}))}}
\L{\LB{}\Tab{12}{\V{nodecnt}_=_\V{label}(\V{e}\-\!\>\V{node},_\V{nodecnt},_\V{edgecnt});}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{\K{return}_\V{nodecnt};}}
\L{\LB{\}}}
\L{\LB{}}
\L{\LB{\K{static}_\K{int}}}
\index{countComponents}\Proc{countComponents}\L{\LB{\V{countComponents}(\V{Agraph\_t}_*_\V{g},_\K{int}_*\V{max\_degree},_\K{float}_*\V{nontree\_frac})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\K{int}_\V{nc}_=_\N{0};}}
\L{\LB{}\Tab{4}{\K{int}_\V{sum\_edges}_=_\N{0};}}
\L{\LB{}\Tab{4}{\K{int}_\V{sum\_nontree}_=_\N{0};}}
\L{\LB{}\Tab{4}{\K{int}_\V{deg};}}
\L{\LB{}\Tab{4}{\K{int}_\V{n\_edges};}}
\L{\LB{}\Tab{4}{\K{int}_\V{n\_nodes};}}
\L{\LB{}\Tab{4}{\V{Agnode\_t}_*\V{n};}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\K{for}_(\V{n}_=_\V{agfstnode}(\V{g});_\V{n};_\V{n}_=_\V{agnxtnode}(\V{g},_\V{n}))_\{}}
\L{\LB{}\Tab{8}{\K{if}_(!\V{getval}(\V{n}))_\{}}
\L{\LB{}\Tab{12}{\V{nc}++;}}
\L{\LB{}\Tab{12}{\V{n\_edges}_=_\N{0};}}
\L{\LB{}\Tab{12}{\V{n\_nodes}_=_\V{label}(\V{n},_\N{0},_\&\V{n\_edges});}}
\L{\LB{}\Tab{12}{\V{sum\_edges}_+=_\V{n\_edges};}}
\L{\LB{}\Tab{12}{\V{sum\_nontree}_+=_(\V{n\_edges}_\-_\V{n\_nodes}_+_\N{1});}}
\L{\LB{}\Tab{8}{\}}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{\K{if}_(\V{max\_degree})_\{}}
\L{\LB{}\Tab{8}{\K{int}_\V{maxd}_=_\N{0};}}
\L{\LB{}\Tab{8}{\K{for}_(\V{n}_=_\V{agfstnode}(\V{g});_\V{n};_\V{n}_=_\V{agnxtnode}(\V{g},_\V{n}))_\{}}
\L{\LB{}\Tab{12}{\V{deg}_=_\V{agdegree}(\V{g},_\V{n},_\V{TRUE},_\V{TRUE});}}
\L{\LB{}\Tab{12}{\K{if}_(\V{maxd}_\<_\V{deg})}}
\L{\LB{}\Tab{16}{\V{maxd}_=_\V{deg};}}
\L{\LB{}\Tab{12}{\V{setval}(\V{n},_\N{0});}}
\L{\LB{}\Tab{8}{\}}}
\L{\LB{}\Tab{8}{*\V{max\_degree}_=_\V{maxd};}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{\K{if}_(\V{nontree\_frac})_\{}}
\L{\LB{}\Tab{8}{\K{if}_(\V{sum\_edges}_\>_\N{0})}}
\L{\LB{}\Tab{12}{*\V{nontree\_frac}_=_(\K{float})_\V{sum\_nontree}_/_(\K{float})_\V{sum\_edges};}}
\L{\LB{}\Tab{8}{\K{else}}}
\L{\LB{}\Tab{12}{*\V{nontree\_frac}_=_\N{0.0};}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{\K{return}_\V{nc};}}
\L{\LB{\}}}
\L{\LB{}}
\index{process}\Proc{process}\L{\LB{\K{static}_\K{void}_\V{process}(\V{Agraph\_t}_*_\V{G})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\V{Agnode\_t}_*\V{n};}}
\L{\LB{}\Tab{4}{\V{Agraph\_t}_*\V{map};}}
\L{\LB{}\Tab{4}{\K{int}_\V{nc}_=_\N{0};}}
\L{\LB{}\Tab{4}{\K{float}_\V{nontree\_frac}_=_\N{0};}}
\L{\LB{}\Tab{4}{\K{int}_\V{Maxdegree}_=_\N{0};}}
\L{\LB{}\Tab{4}{\V{Stack}_\V{stack};}}
\L{\LB{}\Tab{4}{\V{sccstate}_\V{state};}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\V{aginit}(\V{G},_\V{AGRAPH},_\S{}\3scc\_graph\3\SE{},_\K{sizeof}(\V{Agraphinfo\_t}),_\V{TRUE});}}
\L{\LB{}\Tab{4}{\V{aginit}(\V{G},_\V{AGNODE},_\S{}\3scc\_node\3\SE{},_\K{sizeof}(\V{Agnodeinfo\_t}),_\V{TRUE});}}
\L{\LB{}\Tab{4}{\V{state}.\V{Comp}_=_\V{state}.\V{ID}_=_\N{0};}}
\L{\LB{}\Tab{4}{\V{state}.\V{N\_nodes\_in\_nontriv\_SCC}_=_\N{0};}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\K{if}_(\V{Verbose})}}
\L{\LB{}\Tab{8}{\V{nc}_=_\V{countComponents}(\V{G},_\&\V{Maxdegree},_\&\V{nontree\_frac});}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\V{initStack}(\&\V{stack},_\V{agnnodes}(\V{G})_+_\N{1});}}
\L{\LB{}\Tab{4}{\V{map}_=_\V{agopen}(\S{}\3scc\_map\3\SE{},_\V{Agdirected},_(\V{Agdisc\_t}_*)_\N{0});}}
\L{\LB{}\Tab{4}{\K{for}_(\V{n}_=_\V{agfstnode}(\V{G});_\V{n};_\V{n}_=_\V{agnxtnode}(\V{G},_\V{n}))}}
\L{\LB{}\Tab{8}{\K{if}_(\V{getval}(\V{n})_==_\N{0})}}
\L{\LB{}\Tab{12}{\V{visit}(\V{n},_\V{map},_\&\V{stack},_\&\V{state});}}
\L{\LB{}\Tab{4}{\V{freeStack}(\&\V{stack});}}
\L{\LB{}\Tab{4}{\K{if}_(!\V{StatsOnly})}}
\L{\LB{}\Tab{8}{\V{agwrite}(\V{map},_\V{outfp});}}
\L{\LB{}\Tab{4}{\V{agclose}(\V{map});}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\K{if}_(\V{Verbose})}}
\L{\LB{}\Tab{8}{\V{fprintf}(\V{stderr},_\S{}\3\%d_\%d_\%d_\%d_\%.4f_\%d_\%.4f\2n\3\SE{},}}
\L{\LB{}\Tab{16}{\V{agnnodes}(\V{G}),_\V{agnedges}(\V{G}),_\V{nc},_\V{state}.\V{Comp},}}
\L{\LB{}\Tab{16}{\V{state}.\V{N\_nodes\_in\_nontriv\_SCC}_/_(\K{double})_\V{agnnodes}(\V{G}),}}
\L{\LB{}\Tab{16}{\V{Maxdegree},_\V{nontree\_frac});}}
\L{\LB{}\Tab{4}{\K{else}_\K{if}_(!\V{Silent})}}
\L{\LB{}\Tab{8}{\V{fprintf}(\V{stderr},_\S{}\3\%d_nodes,_\%d_edges,_\%d_strong_components\2n\3\SE{},}}
\L{\LB{}\Tab{16}{\V{agnnodes}(\V{G}),_\V{agnedges}(\V{G}),_\V{state}.\V{Comp});}}
\L{\LB{}}
\L{\LB{\}}}
\L{\LB{}}
\index{openFile}\Proc{openFile}\L{\LB{\K{static}_\V{FILE}_*\V{openFile}(\K{char}_*\V{name},_\K{char}_*\V{mode})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\V{FILE}_*\V{fp};}}
\L{\LB{}\Tab{4}{\K{char}_*\V{modestr};}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\V{fp}_=_\V{fopen}(\V{name},_\V{mode});}}
\L{\LB{}\Tab{4}{\K{if}_(!\V{fp})_\{}}
\L{\LB{}\Tab{8}{\K{if}_(*\V{mode}_==_\S{}{'}r{'}\SE{})}}
\L{\LB{}\Tab{12}{\V{modestr}_=_\S{}\3reading\3\SE{};}}
\L{\LB{}\Tab{8}{\K{else}}}
\L{\LB{}\Tab{12}{\V{modestr}_=_\S{}\3writing\3\SE{};}}
\L{\LB{}\Tab{8}{\V{fprintf}(\V{stderr},_\S{}\3gvpack:_could_not_open_file_\%s_for_\%s\2n\3\SE{},}}
\L{\LB{}\Tab{16}{\V{name},_\V{modestr});}}
\L{\LB{}\Tab{8}{\V{exit}(\N{1});}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{\K{return}_(\V{fp});}}
\L{\LB{\}}}
\L{\LB{}}
\L{\LB{\K{static}_\K{char}_*\V{useString}_=_\S{}\3Usage:_\%s_[\-sdv?]_\<files\>\2n\2}}
\L{\LB{}\Tab{2}{\-s}\Tab{15}{\-_only_produce_statistics\2n\2}}
\L{\LB{}\Tab{2}{\-S}\Tab{15}{\-_silent\2n\2}}
\L{\LB{}\Tab{2}{\-d}\Tab{15}{\-_allow_degenerate_components\2n\2}}
\L{\LB{}\Tab{2}{\-o\<outfile\>}\Tab{15}{\-_write_to_\<outfile\>_(stdout)\2n\2}}
\L{\LB{}\Tab{2}{\-v}\Tab{15}{\-_verbose\2n\2}}
\L{\LB{}\Tab{2}{\-?}\Tab{15}{\-_print_usage\2n\2}}
\L{\LB{If_no_files_are_specified,_stdin_is_used\2n\3\SE{};}}
\L{\LB{}}
\index{usage}\Proc{usage}\L{\LB{\K{static}_\K{void}_\V{usage}(\K{int}_\V{v})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\V{printf}(\V{useString},_\V{CmdName});}}
\L{\LB{}\Tab{4}{\V{exit}(\V{v});}}
\L{\LB{\}}}
\L{\LB{}}
\index{scanArgs}\Proc{scanArgs}\L{\LB{\K{static}_\K{void}_\V{scanArgs}(\K{int}_\V{argc},_\K{char}_**\V{argv})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\K{int}_\V{c};}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\V{CmdName}_=_\V{argv}[\N{0}];}}
\L{\LB{}\Tab{4}{\V{opterr}_=_\N{0};}}
\L{\LB{}\Tab{4}{\K{while}_((\V{c}_=_\V{getopt}(\V{argc},_\V{argv},_\S{}\3:o:sdvS\3\SE{}))_!=_\V{EOF})_\{}}
\L{\LB{}\Tab{8}{\K{switch}_(\V{c})_\{}}
\L{\LB{}\Tab{8}{\K{case}_\S{}{'}s{'}\SE{}:}}
\L{\LB{}\Tab{12}{\V{StatsOnly}_=_\N{1};}}
\L{\LB{}\Tab{12}{\K{break};}}
\L{\LB{}\Tab{8}{\K{case}_\S{}{'}d{'}\SE{}:}}
\L{\LB{}\Tab{12}{\V{wantDegenerateComp}_=_\N{1};}}
\L{\LB{}\Tab{12}{\K{break};}}
\L{\LB{}\Tab{8}{\K{case}_\S{}{'}o{'}\SE{}:}}
\L{\LB{}\Tab{12}{\V{outfp}_=_\V{openFile}(\V{optarg},_\S{}\3w\3\SE{});}}
\L{\LB{}\Tab{12}{\K{break};}}
\L{\LB{}\Tab{8}{\K{case}_\S{}{'}v{'}\SE{}:}}
\L{\LB{}\Tab{12}{\V{Verbose}_=_\N{1};}}
\L{\LB{}\Tab{12}{\K{break};}}
\L{\LB{}\Tab{8}{\K{case}_\S{}{'}S{'}\SE{}:}}
\L{\LB{}\Tab{12}{\V{Verbose}_=_\N{0};}}
\L{\LB{}\Tab{12}{\V{Silent}_=_\N{1};}}
\L{\LB{}\Tab{12}{\K{break};}}
\L{\LB{}\Tab{8}{\K{case}_\S{}{'}?{'}\SE{}:}}
\L{\LB{}\Tab{12}{\K{if}_(\V{optopt}_==_\S{}{'}?{'}\SE{})}}
\L{\LB{}\Tab{16}{\V{usage}(\N{0});}}
\L{\LB{}\Tab{12}{\K{else}}}
\L{\LB{}\Tab{16}{\V{fprintf}(\V{stderr},_\S{}\3\%s:_option_\-\%c_unrecognized_\-_ignored\2n\3\SE{},}}
\L{\LB{}\Tab{24}{\V{CmdName},_\V{optopt});}}
\L{\LB{}\Tab{12}{\K{break};}}
\L{\LB{}\Tab{8}{\}}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{\V{argv}_+=_\V{optind};}}
\L{\LB{}\Tab{4}{\V{argc}_\-=_\V{optind};}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\K{if}_(\V{argc})}}
\L{\LB{}\Tab{8}{\V{Files}_=_\V{argv};}}
\L{\LB{}\Tab{4}{\K{if}_(!\V{outfp})}}
\L{\LB{}\Tab{8}{\V{outfp}_=_\V{stdout};}\Tab{32}{\C{}/*_stdout_the_default_*/\CE{}}}
\L{\LB{\}}}
\L{\LB{}}
\index{gread}\Proc{gread}\L{\LB{\K{static}_\V{Agraph\_t}_*\V{gread}(\V{FILE}_*_\V{fp})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\K{return}_\V{agread}(\V{fp},_(\V{Agdisc\_t}_*)_\N{0});}}
\L{\LB{\}}}
\L{\LB{}}
\index{main}\Proc{main}\L{\LB{\K{int}_\V{main}(\K{int}_\V{argc},_\K{char}_**\V{argv})}}
\L{\LB{\{}}
\L{\LB{}\Tab{4}{\V{Agraph\_t}_*\V{g};}}
\L{\LB{}\Tab{4}{\V{ingraph\_state}_\V{ig};}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\V{scanArgs}(\V{argc},_\V{argv});}}
\L{\LB{}\Tab{4}{\V{newIngraph}(\&\V{ig},_\V{Files},_\V{gread});}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\K{while}_((\V{g}_=_\V{nextGraph}(\&\V{ig}))_!=_\N{0})_\{}}
\L{\LB{}\Tab{8}{\K{if}_(\V{agisdirected}(\V{g}))}}
\L{\LB{}\Tab{12}{\V{process}(\V{g});}}
\L{\LB{}\Tab{8}{\K{else}}}
\L{\LB{}\Tab{12}{\V{fprintf}(\V{stderr},_\S{}\3Graph_\%s_in_\%s_is_undirected_\-_ignored\2n\3\SE{},}}
\L{\LB{}\Tab{20}{\V{agnameof}(\V{g}),_\V{fileName}(\&\V{ig}));}}
\L{\LB{}\Tab{8}{\V{agclose}(\V{g});}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}}
\L{\LB{}\Tab{4}{\K{return}_\N{0};}}
\L{\LB{\}}}
